import httpInstance from "@/utils/http.js";
// knowledge相关api

// 增
export const addKnowledgeAPI = (formData) => {
    return httpInstance({
        url: "/knowledge/add",
        method: "POST",
        data: formData,
        header: {
            'Content-Type': 'multipart/form-data'
        }
    })
}

// 删
export const delKnowledgeAPI = (data) => {
    /*
    data:
        {
            knowledge_id: id
        }
     */

    return httpInstance({
        url: "/knowledge/del",
        method: "POST",
        data: data
    })
}

// 改
export const modifyKnowledgeAPI = (data) => {
    /*
    data:
        {
            knowledge_id: id,
            knowledge_name: "new_name"
        }
     */

    return httpInstance({
        url: "/knowledge/modify",
        method: "POST",
        data: data
    })
}

// 查单个
export const detailKnowledgeAPI = (data) => {
    /*
    data:
        {
            knowledge_id: id
        }
     */
    console.log(data)
    return httpInstance({
        url: "/knowledge/detail",
        method: "POST",
        data: data
    })
}

// 查全部
export const listKnowledgeAPI = () => {
    return httpInstance({
        url: "/knowledge/list",
        method: "POST",
    })
}
